﻿#region Disclaimer/Info

/////////////////////////////////////////////////////////////////////////////////////////////////
//
//   File:		Role.Validation.cs
//   Website:		http://dexterblogengine.com/
//   Authors:		http://dexterblogengine.com/About.ashx
//   Rev:		1
//   Created:		23/02/2011
//   Last edit:		23/0122011
//   License:		GNU Library General Public License (LGPL)
//   File:            User.Validation.cs
//   For updated news and information please visit http://dexterblogengine.com/
//   Dexter is hosted to Codeplex at http://dexterblogengine.codeplex.com
//   For any question contact info@dexterblogengine.com
//
///////////////////////////////////////////////////////////////////////////////////////////////////

#endregion

using Topics.Radical.Validation;

namespace Dexter.Domain.Model
{
	public partial class Role
	{
		public virtual void ValidateForSave()
		{
			Ensure.That(Id)
				.Named("Id")
				.WithPreview((v, e) => Logger.Warn(v.GetFullErrorMessage(), e))
				.Is(0)
				.WithMessage("Invalid role key.");
		}

		public virtual void ValidateForUpdate()
		{
			Ensure.That(Id)
				.Named("Id")
				.WithPreview((v, e) => Logger.Warn(v.GetFullErrorMessage(), e))
				.IsGreaterThen(0)
				.WithMessage("Invalid role key.");
		}

		public virtual void ValidateForDelete()
		{
			Ensure.That(Id)
				.Named("Id")
				.WithPreview((v, e) => Logger.Warn(v.GetFullErrorMessage(), e))
				.IsGreaterThen(0)
				.WithMessage("Invalid role key.");
		}
	}
}